<script type="text/javascript" src="http://10.1.2.96:8090/mdg-social-elgg/vendors/jquery/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="http://10.1.2.96:8090/mdg-social-elgg/vendors/jquery/jquery-ui-1.8.16.min.js"></script>
<script type="text/javascript" src="http://10.1.2.96:8090/mdg-social-elgg/js/elgg.0.js?view=default"></script>

<?php
$postfields = array();
$postfields['username'] = 'duanhv';
$postfields['password'] = '123456';
$postfields['method'] = 'auth.gettoken';

$url = 'http://igolf.vn/services/api/rest/json/';
$curl = curl_init();
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, 3);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
$result = curl_exec($curl);
curl_close($curl);
echo $result;
?>

<script>
$.ajax({type: "POST",
	url: '<?php echo elgg_get_site_url() . "services/api/rest/json/" ?>',
	dataType: "json",
	cache: false,
	data: {
		username:"khangmdg1",
		password:"123456",
		method:"auth.gettoken",
	},
	success: function(data) {
		console.log(data);
		$('#status').html(data.status);
		$('#message').html(data.message);
		$('#result').html(data.result)
	}
});
</script>
<div>RESULT:</div>
<div id="status"></div>
<div id="result"></div>
<div id="message"></div>